<!DOCTYPE html>
<html lang="en">
<head>
  <meta charset="UTF-8">
  <meta name="viewport" content="width=device-width, initial-scale=1.0">
  <meta http-equiv="X-UA-Compatible" content="ie=edge">
  <title>Document</title>

  <style>
    * {
      box-sizing: border-box;
    }
    div{
      width: 200px;
      height: 80px;
      border: 2px solid #eee;
      position: relative;
    }
  
    div::before, div::after {
      content: "";
      position: absolute;
      /* width: 198px; */
      /* height: 78px; */
      width: 0;
      height: 0;
      opacity: 0;
      
    }

    div::before {
      border-top: 2px solid #000;
      border-right: 2px solid #000;
      top: -2px;
      left: -2px;
      transition: width 1s 3s, height 1s 2s, opacity .3s 3.7s;
    }
    div::after {
      border-bottom: 2px solid #000;
      border-left: 2px solid #000;
      right: -2px;
      bottom: -2px;
      transition: width 1s 1s, height 1s, opacity .3s 1.7s;
    }

    div:hover::before, div:hover::after {
      width: 198px;
      height: 78px;
      opacity: 1;
    }
    
    div:hover::before {
      transition: width 1s, height 1s 1s, opacity .3s;
      
    }
    div:hover::after {
      transition: width 1s 2s, height 1s 3s, opacity .3s 2s;      
    }
  </style>
</head>
<body>
  <div></div>
</body>
</html>